1. Technical Field
The present invention relates in general to application development and in particular to revisions to source code during application development. Still more particularly, the present invention relates to automatically replicating revisions from one source code segment to other segments during application development.
2. Description of the Related Art
Developers utilize various tools for generating highlevel language source code for applications. Tools such as IBM VisualAge Java, Symantec Visual Cafe Pro, or Borland JBuilder, for example, are employed to develop Java applications having an integrated GUI interface within server/client source code. These tools are advanced to the point of automatically generating GUI code from the user-drawn graphical interface. They are severely limited, however, in functionality for generating or changing large amounts of non-GUI code.
Developers frequently need to make similar changes to large sections of code. For instance, a Java application which draws a map of the United States, including each individual state, may be drawn by defining polygons for each state such as the following:
int cox()={187, 251, 250, 178, 187}; PA1 int coy()={101, 105, 142, 140, 101}; PA1 int cop=cox.length PA1 Polygon co=new Polygon (cox, coy, cop); PA1 int cox={(int)(187*x), (int)(251*x), (int)(250*x), (int)(178*x), (int)(187*x)}; PA1 int coy()={(int)(101*y), (int)(105*y), (int)(142*y), (int)(140*y), (int)(101*y)}; PA1 int cop=cox.length PA1 Polygon co=new Polygon (cox, coy, cop); PA1 (1) Copying "(int)(" to the clipboard; PA1 (2) Pasting "(int)(" in front of each element in both the x-arrays and the y-arrays; PA1 (3) Copying "*x" to the clipboard; PA1 (4) Pasting "*x" in after each element in every x-array; PA1 (5) Copying "*y" to the clipboard; and PA1 (6) Pasting "*y" in after each element in every y-array.
This code defines four x-coordinates in the "cox" array, four y-coordinates in the "coy" array, the number of points in the integer "cop," and the Colorado polygon in the "co" polygon. Code similar to this would be replicated for each of the 50 states, resulting in at least 200 lines of code. Furthermore, some polygons would be extremely complex, such as the polygon for Texas, would requires 42 x- and y-coordinates.
If, as is frequently the case, the developer's requirements change after the code for all 50 states has been formulated, the code must be altered to satisfy the new requirements. For the example specified above, if relative coordinates are required in lieu of absolute coordinates, the source code for the Colorado polygon must be changed to:
The Colorado polygon may now be drawn at a specified point (x, y) in the display, where x and y are defined as floating point variables (which necessitates the "(int)" cast to cast the array elements back to integers).
In replicating the above changes for all fifty states, the developer must change all of the elements of all x-arrays from "NUM" to "(int)(NUM*x)" and all of the elements of all y-arrays from "NUM" to "(int)(NUM*y)". This is a painstaking task, which may be achieved with present tools most efficiently by:
Given that there are up to 42 array elements for each of 50 states, these manual operations must be performed on up to 2,000 elements. Even with the method described above, this requires hours for editing and for debug during compilation.
It would be desirable, therefore, to provide a tool for automatically replicating similar changes in non-GUI code during development.